var user = {
	check(){
		var that = this;
		uni.checkSession({
			success(){
				
			},
			fail(){
				uni.login({
					provider: 'weixin',
					  success: function (loginRes) {
					    uni.setStorageSync('code',loginRes.code);
					  }
				})
			}
		})
	},
	wxLogin(callBack){
		uni.login({
			provider: 'weixin',
			  success: function (loginRes) {
			    callBack(loginRes);
			  }
		})
	},
	isLogin(nextUrl){
		var token = uni.getStorageSync('token');
		if(!token){
			uni.showToast({
				title: '请登录后操作',
				icon : 'none',
				duration : 2500,
				success : function(){
					uni.navigateTo({
						url: '/pages/auth/auth',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				}
			});	
		}else{
			
			uni.navigateTo({
				url: nextUrl,
				success: res => {},
				fail: () => {},
				complete: () => {}
			});
		}
	}
};
module.exports = {
 user,
}